<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>case.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
	<script type="text/javascript">
		window.onload=function(){
			var mtd=document.getElementsByTagName("tr");
			for(var i=1;i<=mtd.length;i++){
				
				if(i%2==0){
					mtd[i].style.background= 'green';
				}else{
					mtd[i].style.background= 'red';
				}
			}
		}
		
	function clickAll(){
  		var inArray = document.getElementsByTagName("input");
  		inArray[1].checked=false;
  		if(inArray[0].checked==true){
  			for(var i=2;i<inArray.length;i++){
  				inArray[i].checked=true;
  			}
  		}else{
  			for(var i=2;i<inArray.length;i++){
  				inArray[i].checked=false;
  			}
  		}
  		
  	}
  	function Invert(){
  		var inArray = document.getElementsByTagName("input");
  		inArray[0].checked=false;
  		if(inArray[1].checked==false){
  			return;
  		}
  		for(var i=2;i<inArray.length;i++){
  			var it = inArray[i];
  			inArray[i].checked=!it.checked;
  		}
  	}
		
	
	</script>
  </head>
  
  <body>
  	<table>
  		<tr><th>用户姓名</th><th>用户性别</th><th>用户年龄</th></tr>
  		<tr><td>无名</td><td>男</td><td>100</td></tr>
  		<tr><td>小明</td><td>男</td><td>不明</td></tr>
  		<tr><td>柯南</td><td>男</td><td>万年小学生</td></tr>
  	</table>
  	  <input type="checkbox" onclick="clickAll()">全选<input type="checkbox" onclick="Invert()">反选<br/>
  	  <input type="checkbox" >篮球
	  <input type="checkbox" >足球
	  <input type="checkbox" >排球
	
  	  
  </body>
</html>
